/**
 * @program: yygh_parent
 * @ClassName SmsListener
 * @description:
 * @author: zyw
 * @create: 2023-06-08 15:07
 * @Version 1.0
 **/
package com.atguigu.yygh.sms.listener;

import com.atguigu.yygh.mq.MqConst;
import com.atguigu.yygh.sms.service.SmsService;
import com.atguigu.yygh.vo.msm.MsmVo;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SmsListener {
    @Autowired
    private SmsService smsService;
    @RabbitListener(bindings = {
            @QueueBinding(
                    value = @Queue(name = MqConst.QUEUE_MSM_ITEM),
                    exchange = @Exchange(name = MqConst.EXCHANGE_DIRECT_MSM),
                    key = MqConst.ROUTING_MSM_ITEM
            )
    }
    )
    public void comnsume(MsmVo msmVo, Message message, Channel channel) {
         smsService.sendMessage(msmVo);
    }
}
 
